/*
 * Copyright (c) 2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_ARC_INDEXER_PAINT_METHOD_H
#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_ARC_INDEXER_PAINT_METHOD_H

#include "core/components_ng/pattern/indexer/arc_indexer_content_modifier.h"
#include "core/components_ng/pattern/indexer/indexer_paint_property.h"
#include "core/components_ng/pattern/indexer/indexer_theme.h"
#include "core/components_ng/render/node_paint_method.h"
#include "core/pipeline/pipeline_base.h"

namespace OHOS::Ace::NG {
class ACE_EXPORT ArcIndexerPaintMethod : public NodePaintMethod {
    DECLARE_ACE_TYPE(ArcIndexerPaintMethod, NodePaintMethod)
public:
    ArcIndexerPaintMethod(float strokeWidth, OffsetF arcCenter, float startAngle, float sweepAngle,
        float arcRadius, float stepAngle, RefPtr<ArcIndexerContentModifier> arcindexerModifier)
        : strokeWidth_(strokeWidth), arcCenter_(arcCenter), startAngle_(startAngle),
          sweepAngle_(sweepAngle), arcRadius_(arcRadius), stepAngle_(stepAngle),
          arcindexerModifier_(arcindexerModifier)
    {}
    ~ArcIndexerPaintMethod() override = default;

    RefPtr<Modifier> GetContentModifier(PaintWrapper* paintWrapper) override
    {
        CHECK_NULL_RETURN(arcindexerModifier_, nullptr);
        return arcindexerModifier_;
    }

    void UpdateContentModifier(PaintWrapper* paintWrapper) override
    {
        CHECK_NULL_VOID(arcindexerModifier_);

        arcindexerModifier_->SetStrokeWidth(strokeWidth_);
        arcindexerModifier_->SetArcCenter(arcCenter_);
        arcindexerModifier_->SetStartAngle(startAngle_);
        arcindexerModifier_->SetSweepAngle(sweepAngle_);
        arcindexerModifier_->SetArcRadius(arcRadius_);
        arcindexerModifier_->SetStepAngle(stepAngle_);
    }

private:
    float strokeWidth_ = 0.0f;
    OffsetF arcCenter_;
    float startAngle_ = 0.0f;
    float sweepAngle_ = 0.0f;
    float arcRadius_ = 0.0f;
    float stepAngle_ = 0.0f;

    RefPtr<ArcIndexerContentModifier> arcindexerModifier_;
    ACE_DISALLOW_COPY_AND_MOVE(ArcIndexerPaintMethod);
};
} // namespace OHOS::Ace::NG

#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_ARC_INDEXER_PAINT_METHOD_H
